import 'package:flutter/material.dart';
import '../../../msg/room_msg.dart';
import 'room_msg_item_builder.dart';
import 'widget/show_items_widget.dart';

/// 公屏消息builder，富文本消息
class RoomGiftMsgItemBuider with RoomMsgItemBuilder {
  @override
  bool support(RoomMsg msg) => true;

  @override
  Widget buildContent(BuildContext context, RoomMsg msg) {
    return _generateContentContainer(
      context,
      msg,
      ShowItemsWidget(rtmMsg: msg.rtmMsg),
    );
  }

  Widget _generateContentContainer(
    BuildContext context,
    RoomMsg msg,
    Widget? body,
  ) {
    return Stack(
      clipBehavior: Clip.none,
      children: [
        Container(
            decoration: BoxDecoration(
                borderRadius: const BorderRadiusDirectional.only(
                  topStart: Radius.circular(8),
                  topEnd: Radius.circular(8),
                  bottomStart: Radius.circular(8),
                  bottomEnd: Radius.circular(8),
                ),
                gradient: LinearGradient(
                    colors: [
                      const Color(0xFFFFFFFF).withValues(alpha: 0.05),
                      const Color(0xFFFFFFFF).withValues(alpha: 0.05)
                    ],
                    begin: AlignmentDirectional.bottomStart,
                    end: AlignmentDirectional.topEnd)),
            padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
            child: body)
      ],
    );
  }
}
